import java.util.HashMap;
import java.util.Scanner;

public class demo1 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str1=scanner.next();
        String str2=scanner.next();
        if(str1.length()!=str2.length()) {
            System.out.println("NO");
            return;
        }
        HashMap<Character,Integer> hashMap1=new HashMap<>();
        HashMap<Character,Integer>hashMap2=new HashMap<>();
        for (int i = 0; i <str1.length() ; i++) {
            hashMap1.put(str1.charAt(i), hashMap1.getOrDefault(str1.charAt(i),0)+1);
        }
        for(int i=i=0;i<str2.length();i++){
            hashMap2.put(str2.charAt(i), hashMap2.getOrDefault(str2.charAt(i),0)+1);
            if(!hashMap1.containsKey(str2.charAt(i))){
                System.out.println("NO");
                return;
            }else{
                if(hashMap1.get(str2.charAt(i))<hashMap2.get(str2.charAt(i))){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("YES");
    }
}
